home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / STRTOD.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  446 b   |  14 lines

  1. /* strtod.c, from p.181 of Turbo C Bible  */
  2. /* Converts a string to a double-precision floating-point value. */
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. main()
  6. {
  7.     char input[80], *stop_at;
  8.     double value;
  9.     printf("Enter a number followed by other characters\n");
  10.     gets(input);
  11.     value = strtod(input, &stop_at);    /* Now convert the number to  */
  12.     printf("Value = %g\n"
  13.         "Stopped at: %s\n", value, stop_at); /*  internal value   */
  14. }